import { AxiosResponse } from 'axios';
import { Get, Post } from '../axios';


/* 上传免签描述文件 */
interface UpmmiaoInterface {
    (data: {
        name: string,
        url: string,
        img: string
    }): Promise<AxiosResponse<any>>
}
export const upmmiao: UpmmiaoInterface = async (data) => {
    try {
        return await Post({ url: "/miaomod/addmiao", data });
    } catch (error) {
        throw error
    }
}


/* 删除免签分发应用*/
interface DelmiaoInterface {
    (data: {
        id: string,                     /*免签分发应用id*/
    }): Promise<AxiosResponse<any>>
}
export const delmiao: DelmiaoInterface = async (data) => {
    try {
        return await Post({ url: "/miaomod/delmiao", data });
    } catch (error) {
        throw error
    }
}



/* 修改免签分发应用 */
interface UpmiaoInterface {
    (data: {
        id: string,                    /* 免签分发id */
        merge?: string,                /* 合并参数 */
        codestatus?: boolean,          /* 是否需要下载码 */
        accountPool?: string           /* 证书池 */
    }): Promise<AxiosResponse<any>>
}
export const upmiao: UpmiaoInterface = async (data) => {
    try {
        return await Post({ url: "/miaomod/upmiao", data });
    } catch (error) {
        throw error
    }
}



/* 查询免签分发应用 */
interface GetmiaoInterface {
    (data: {
        pageNo: number,                    /* 当前页数 */
        pageSize: number,                  /* 页面总条数 */
        id?: string | null
    }): Promise<AxiosResponse<any>>
}
export const getmiao: GetmiaoInterface = async (data) => {
    try {
        return await Post({ url: "/miaomod/getmiao", data });
    } catch (error) {
        throw error
    }
}



/* 搜索免签分发应用 */
interface SchmiaoInterface {
    (data: {
        remarks: string                     /*备注*/
    }): Promise<AxiosResponse<any>>
}
export const schmiao: SchmiaoInterface = async (data) => {
    try {
        return await Get({ url: "/miaomod/searchmiao", data });
    } catch (error) {
        throw error
    }
}




